package com.demo.hadoop.storm;

import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.topology.TopologyBuilder;

/**
 * @author lee9213@163.com
 * @version 1.0
 * @date 2017/3/23 15:18
 */
public class MainJob {

    public static void main(String[] args) {
        TopologyBuilder builder = new TopologyBuilder();
        builder.setSpout("log-reader", new LogReader());
        builder.setBolt("log-analysis", new LogAnalysis()).shuffleGrouping("log-reader");
        builder.setBolt("pageview-counter", new PageViewCounter(), 2).shuffleGrouping("log-analysis");
        Config config = new Config();
        config.setDebug(false);
        config.put(Config.TOPOLOGY_MAX_SPOUT_PENDING, 1);

        LocalCluster cluster = new LocalCluster();
        cluster.submitTopology("log-process-toplogie", config, builder.createTopology());
    }
}
